package admin

import (
	"github.com/gin-gonic/gin"
	"mydemo/models"
	"net/http"
)

type ArticleController struct {
}

func (con ArticleController) Index(c *gin.Context) {
	c.String(http.StatusOK, "文章列表")
}
func (con ArticleController) Add(c *gin.Context) {
	titles := []string{"文章1", "文章2"}
	for i := range titles {
		article := models.Article{
			Title: titles[1],
			State: i,
		}
		models.DB.Create(&article)
	}
}
func (con ArticleController) Edit(c *gin.Context) {
	c.String(200, "文章列表-edit")
}
